Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stacked config not used on commands #23

Merged
merged 3 commits into from
May 25, 2023

Conversation

ferrarafer
Copy link
Contributor

  • Fixed stacked config inside project not used on commands execution
  • Added --config-path option to all commands where configuration file is needed
  • Added verification file exists on _clean method before deletion

Fixes Stacked-Org/stacked#912
Fixes Stacked-Org/stacked#960

Copy link
Contributor

@FilledStacks FilledStacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one question.

Another question I have is to please put an example of how it works to make it easier to review.

@@ -41,13 +41,22 @@ class DeleteViewCommand extends Command with ProjectStructureValidator {
help: 'The length of the line that is used for formatting',
valueHelp: '80',
);

argParser.addOption(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ferrarafer does adding this here mean we have to pass the config path every time we run a command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just when you want to do something different as the project configuration in the root of the project, stacked.json.

config-path-demo.mp4

lib/src/services/config_service.dart Show resolved Hide resolved
@ferrarafer
Copy link
Contributor Author

ferrarafer commented May 25, 2023

Another question I have is to please put an example of how it works to make it easier to review.

Good suggestion @FilledStacks !

All the commands except create app command loads the configuration file, stacked.json, from the root of the project unless you pass a custom configuration or a partial custom configuration through --config-path option.

Examples (current user location on terminal: my/path/to/my_project)

$> stacked create view settings

Will loads configuration from my/path/to/my_project/stacked.json

$> stacked create view settings --config-path=/Users/filledstacks/Desktop/dane.config.json

Will loads configuration from /Users/filledstacks/Desktop/dane.config.json


The create app command works different for obvious reason, as project does not exists there is no configuration inside to look for. When you create a project with stacked_cli you have 3 options.

Examples (current user location on terminal: my/path/to/my_project)

$> stacked create app my_app
  • Global configuration, will loads configuration from /Users/filledstacks/.config/stacked/stacked.json.
  • Default configuration, will loads default Stacked configuration, if there is no global configuration file on the location above.
  • Next, will export configuration into stacked.json in the root of the project created.
$> stacked create app my_app --config-path=/Users/filledstacks/Desktop/dane.config.json
  • Custom configuration, will loads configuration from the given location, /Users/filledstacks/Desktop/dane.config.json. Note, if configuration file is not found, will show an error for the user to correct the config-path option.
  • Next, will export configuration into stacked.json in the root of the project created.

Copy link
Contributor

@FilledStacks FilledStacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I appreciate the detailed comments

@FilledStacks FilledStacks merged commit 083aa0b into main May 25, 2023
@FilledStacks FilledStacks deleted the fix/stacked-config-not-used-on-commands branch May 25, 2023 13:47
FilledStacks pushed a commit that referenced this pull request May 25, 2023
## [1.8.3](v1.8.2...v1.8.3) (2023-05-25)

### Bug Fixes

* stacked config not used on commands ([#23](#23)) ([083aa0b](083aa0b))
@FilledStacks
Copy link
Contributor

🎉 This PR is included in version 1.8.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants